<html>
<head><meta charset="utf-8"><title>LNK1189 &quot;library limit of 65535 obj exceeded&quot; (#53014) · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/LNK1189.20.22library.20limit.20of.2065535.20obj.20exceeded.22.20(.2353014).html">LNK1189 &quot;library limit of 65535 obj exceeded&quot; (#53014)</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="162534041"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/LNK1189%20%22library%20limit%20of%2065535%20obj%20exceeded%22%20%28%2353014%29/near/162534041" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mw <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/LNK1189.20.22library.20limit.20of.2065535.20obj.20exceeded.22.20(.2353014).html#162534041">(Apr 04 2019 at 15:03)</a>:</h4>
<p><span class="user-mention" data-user-id="116083">@pnkfelix</span> The code here already supports shrinking the number of CGUs to a defined value:</p>



<a name="162534056"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/LNK1189%20%22library%20limit%20of%2065535%20obj%20exceeded%22%20%28%2353014%29/near/162534056" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mw <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/LNK1189.20.22library.20limit.20of.2065535.20obj.20exceeded.22.20(.2353014).html#162534056">(Apr 04 2019 at 15:03)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/blob/e43f99ce576152d4b2f7315d491c4210211228d6/src/librustc_mir/monomorphize/partitioning.rs#L235-L241" target="_blank" title="https://github.com/rust-lang/rust/blob/e43f99ce576152d4b2f7315d491c4210211228d6/src/librustc_mir/monomorphize/partitioning.rs#L235-L241">https://github.com/rust-lang/rust/blob/e43f99ce576152d4b2f7315d491c4210211228d6/src/librustc_mir/monomorphize/partitioning.rs#L235-L241</a></p>



<a name="162534120"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/LNK1189%20%22library%20limit%20of%2065535%20obj%20exceeded%22%20%28%2353014%29/near/162534120" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/LNK1189.20.22library.20limit.20of.2065535.20obj.20exceeded.22.20(.2353014).html#162534120">(Apr 04 2019 at 15:03)</a>:</h4>
<p>does that readily generalize to incremental ?</p>



<a name="162534142"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/LNK1189%20%22library%20limit%20of%2065535%20obj%20exceeded%22%20%28%2353014%29/near/162534142" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mw <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/LNK1189.20.22library.20limit.20of.2065535.20obj.20exceeded.22.20(.2353014).html#162534142">(Apr 04 2019 at 15:03)</a>:</h4>
<p>yes</p>



<a name="162534212"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/LNK1189%20%22library%20limit%20of%2065535%20obj%20exceeded%22%20%28%2353014%29/near/162534212" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/LNK1189.20.22library.20limit.20of.2065535.20obj.20exceeded.22.20(.2353014).html#162534212">(Apr 04 2019 at 15:04)</a>:</h4>
<p>k</p>



<a name="162534227"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/LNK1189%20%22library%20limit%20of%2065535%20obj%20exceeded%22%20%28%2353014%29/near/162534227" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mw <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/LNK1189.20.22library.20limit.20of.2065535.20obj.20exceeded.22.20(.2353014).html#162534227">(Apr 04 2019 at 15:04)</a>:</h4>
<p>you basically just need to adjust the policy</p>



<a name="162534271"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/LNK1189%20%22library%20limit%20of%2065535%20obj%20exceeded%22%20%28%2353014%29/near/162534271" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mw <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/LNK1189.20.22library.20limit.20of.2065535.20obj.20exceeded.22.20(.2353014).html#162534271">(Apr 04 2019 at 15:04)</a>:</h4>
<p>if you set only an upper limit then test cases should not be affected</p>



<a name="162534339"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/LNK1189%20%22library%20limit%20of%2065535%20obj%20exceeded%22%20%28%2353014%29/near/162534339" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mw <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/LNK1189.20.22library.20limit.20of.2065535.20obj.20exceeded.22.20(.2353014).html#162534339">(Apr 04 2019 at 15:05)</a>:</h4>
<p>it might make sense to <em>generally</em> set a limit of X here</p>



<a name="162534350"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/LNK1189%20%22library%20limit%20of%2065535%20obj%20exceeded%22%20%28%2353014%29/near/162534350" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/LNK1189.20.22library.20limit.20of.2065535.20obj.20exceeded.22.20(.2353014).html#162534350">(Apr 04 2019 at 15:05)</a>:</h4>
<p>okay. so maybe I'll even have something we can readily beta-backport, soon</p>



<a name="162534352"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/LNK1189%20%22library%20limit%20of%2065535%20obj%20exceeded%22%20%28%2353014%29/near/162534352" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mw <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/LNK1189.20.22library.20limit.20of.2065535.20obj.20exceeded.22.20(.2353014).html#162534352">(Apr 04 2019 at 15:05)</a>:</h4>
<p>1000?</p>



<a name="162534366"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/LNK1189%20%22library%20limit%20of%2065535%20obj%20exceeded%22%20%28%2353014%29/near/162534366" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mw <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/LNK1189.20.22library.20limit.20of.2065535.20obj.20exceeded.22.20(.2353014).html#162534366">(Apr 04 2019 at 15:05)</a>:</h4>
<p>10000?</p>



<a name="162534398"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/LNK1189%20%22library%20limit%20of%2065535%20obj%20exceeded%22%20%28%2353014%29/near/162534398" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mw <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/LNK1189.20.22library.20limit.20of.2065535.20obj.20exceeded.22.20(.2353014).html#162534398">(Apr 04 2019 at 15:05)</a>:</h4>
<p>666!</p>



<a name="162534412"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/LNK1189%20%22library%20limit%20of%2065535%20obj%20exceeded%22%20%28%2353014%29/near/162534412" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mw <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/LNK1189.20.22library.20limit.20of.2065535.20obj.20exceeded.22.20(.2353014).html#162534412">(Apr 04 2019 at 15:05)</a>:</h4>
<p>seems like a sensible choice</p>



<a name="162534560"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/LNK1189%20%22library%20limit%20of%2065535%20obj%20exceeded%22%20%28%2353014%29/near/162534560" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mw <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/LNK1189.20.22library.20limit.20of.2065535.20obj.20exceeded.22.20(.2353014).html#162534560">(Apr 04 2019 at 15:06)</a>:</h4>
<p>I'm a bit surprised though that we reach 65536 rust modules in a single crate</p>



<a name="162534591"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/LNK1189%20%22library%20limit%20of%2065535%20obj%20exceeded%22%20%28%2353014%29/near/162534591" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mw <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/LNK1189.20.22library.20limit.20of.2065535.20obj.20exceeded.22.20(.2353014).html#162534591">(Apr 04 2019 at 15:06)</a>:</h4>
<p>that seems like a lot, even for <code>librustc</code></p>



<a name="162554453"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/LNK1189%20%22library%20limit%20of%2065535%20obj%20exceeded%22%20%28%2353014%29/near/162554453" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/LNK1189.20.22library.20limit.20of.2065535.20obj.20exceeded.22.20(.2353014).html#162554453">(Apr 04 2019 at 18:33)</a>:</h4>
<blockquote>
<p>that seems like a lot, even for <code>librustc</code></p>
</blockquote>
<p>yes. it makes me wonder if there is something else going on.</p>



<a name="162554456"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/LNK1189%20%22library%20limit%20of%2065535%20obj%20exceeded%22%20%28%2353014%29/near/162554456" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/LNK1189.20.22library.20limit.20of.2065535.20obj.20exceeded.22.20(.2353014).html#162554456">(Apr 04 2019 at 18:33)</a>:</h4>
<p>but we will see.</p>



<a name="162575149"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/LNK1189%20%22library%20limit%20of%2065535%20obj%20exceeded%22%20%28%2353014%29/near/162575149" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Zoxc <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/LNK1189.20.22library.20limit.20of.2065535.20obj.20exceeded.22.20(.2353014).html#162575149">(Apr 04 2019 at 22:25)</a>:</h4>
<p><span class="user-mention" data-user-id="124287">@mw</span> I'm pretty sure objects refer to symbols here. I'll try to bisect the cause of this for debug builds (takes soo long though). I do know that release builds have fewer than 64k symbols in librustc.</p>



<a name="162603863"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/LNK1189%20%22library%20limit%20of%2065535%20obj%20exceeded%22%20%28%2353014%29/near/162603863" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mw <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/LNK1189.20.22library.20limit.20of.2065535.20obj.20exceeded.22.20(.2353014).html#162603863">(Apr 05 2019 at 08:36)</a>:</h4>
<p><span class="user-mention" data-user-id="116466">@Zoxc</span> yes, that makes sense. In that case, reducing the number of object files won't help.</p>



<a name="162686773"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/LNK1189%20%22library%20limit%20of%2065535%20obj%20exceeded%22%20%28%2353014%29/near/162686773" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Zoxc <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/LNK1189.20.22library.20limit.20of.2065535.20obj.20exceeded.22.20(.2353014).html#162686773">(Apr 06 2019 at 06:07)</a>:</h4>
<p><span class="user-mention" data-user-id="124287">@mw</span>  I bisected the debug build regression to <a href="https://github.com/rust-lang/rust/pull/48779" target="_blank" title="https://github.com/rust-lang/rust/pull/48779">https://github.com/rust-lang/rust/pull/48779</a>.<br>
rustc.dll exports goes from 3980 symbols to 3992 symbols.</p>



<a name="162698270"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/LNK1189%20%22library%20limit%20of%2065535%20obj%20exceeded%22%20%28%2353014%29/near/162698270" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Zoxc <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/LNK1189.20.22library.20limit.20of.2065535.20obj.20exceeded.22.20(.2353014).html#162698270">(Apr 06 2019 at 11:42)</a>:</h4>
<p>Doing a current release build with <code>-Z share-generics=on</code> bumps it to 57658</p>



<a name="162701431"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/LNK1189%20%22library%20limit%20of%2065535%20obj%20exceeded%22%20%28%2353014%29/near/162701431" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Zoxc <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/LNK1189.20.22library.20limit.20of.2065535.20obj.20exceeded.22.20(.2353014).html#162701431">(Apr 06 2019 at 13:12)</a>:</h4>
<p>mingw release builds have 45964 symbols for rustc.dll, it kind of seems like <code>-Z share-generics</code> is forced on somehow?</p>



<a name="162701636"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/LNK1189%20%22library%20limit%20of%2065535%20obj%20exceeded%22%20%28%2353014%29/near/162701636" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Zoxc <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/LNK1189.20.22library.20limit.20of.2065535.20obj.20exceeded.22.20(.2353014).html#162701636">(Apr 06 2019 at 13:18)</a>:</h4>
<p>I don't see any overrides for mingw. Maybe we set the wrong symbol visibility for it?</p>



<a name="162704156"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/LNK1189%20%22library%20limit%20of%2065535%20obj%20exceeded%22%20%28%2353014%29/near/162704156" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Zoxc <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/LNK1189.20.22library.20limit.20of.2065535.20obj.20exceeded.22.20(.2353014).html#162704156">(Apr 06 2019 at 14:28)</a>:</h4>
<p>It seems like mingw + incremental compilation causes generic functions to be exported from dlls even without <code>-Z share-generics</code>. I had incremental off when building rustc, so there's some other cause to this too.</p>



<a name="162705746"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/LNK1189%20%22library%20limit%20of%2065535%20obj%20exceeded%22%20%28%2353014%29/near/162705746" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Zoxc <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/LNK1189.20.22library.20limit.20of.2065535.20obj.20exceeded.22.20(.2353014).html#162705746">(Apr 06 2019 at 15:11)</a>:</h4>
<p>I think this due to us explictly listing which functions we want to export, but only on msvc</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>